package com.example.cloudsampleprovider.contoller;

import com.example.cloudsampleprovider.service.HelloService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

@RestController
@Slf4j
public class HelloController {


    @Autowired
    private HelloService helloService;

    @RequestMapping("/api1/sayHello")
    public String api1SayHello() {
        return helloService.sayHello(LocalDateTime.now().toString());
    }

    @RequestMapping("/api1/sayBy")
    public String api1SayBy() {
        String s = helloService.sayHello("sayBy");
        return "sayBy" + " " + s;
    }

    @RequestMapping("/api2/sayHello")
    public String api2SayHello() {
        return helloService.sayHello(LocalDateTime.now().toString());
    }

    @RequestMapping("/api2/sayBy")
    public String api2sayBy() {
        String s = helloService.sayHello("sayBy");
        return "sayBy" + " " + s;
    }


}
